package org.kl.bpm.entity.conf;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.NotBlank;
import org.kl.bf.entity.IdEntity;
import org.kl.bf.entity.basic.User;

/**
 * 
 * @Author hqm
 * @CreateTime 2014年5月25日 下午7:44:02
 */
@Entity
@Table(name = "BPM_CONF_NOTICE")
public class BpmConfNotice extends IdEntity {
	private static final long serialVersionUID = 0L;
	@NotNull(message = "邮件模板不能为空")
	private BpmMailTemplate bpmMailTemplate;
	private BpmConfNode bpmConfNode;
	@NotNull(message = "类型不能为空")
	private Integer type;// 0：到达，1：完成，3：超时
	@NotBlank(message = "提醒人不能为空")
	private String receiver;
	private String dueDate;

	private User receiverUser;

	public BpmConfNotice() {
	}

	public BpmConfNotice(BpmMailTemplate bpmMailTemplate, BpmConfNode bpmConfNode, Integer type, String receiver, String dueDate) {
		this.bpmMailTemplate = bpmMailTemplate;
		this.bpmConfNode = bpmConfNode;
		this.type = type;
		this.receiver = receiver;
		this.dueDate = dueDate;
	}

	@ManyToOne
	@JoinColumn(name = "TEMPLATE_ID")
	public BpmMailTemplate getBpmMailTemplate() {
		return this.bpmMailTemplate;
	}

	/**
	 * @param bpmMailTemplate
	 *            null.
	 */
	public void setBpmMailTemplate(BpmMailTemplate bpmMailTemplate) {
		this.bpmMailTemplate = bpmMailTemplate;
	}

	/** @return null. */
	@ManyToOne
	@JoinColumn(name = "NODE_ID")
	public BpmConfNode getBpmConfNode() {
		return this.bpmConfNode;
	}

	/**
	 * @param bpmConfNode
	 *            null.
	 */
	public void setBpmConfNode(BpmConfNode bpmConfNode) {
		this.bpmConfNode = bpmConfNode;
	}

	/** @return null. */
	@Column(name = "TYPE")
	public Integer getType() {
		return this.type;
	}

	/**
	 * @param type
	 *            null.
	 */
	public void setType(Integer type) {
		this.type = type;
	}

	/** @return null. */
	@Column(name = "RECEIVER", length = 200)
	public String getReceiver() {
		return this.receiver;
	}

	/**
	 * @param receiver
	 *            null.
	 */
	public void setReceiver(String receiver) {
		this.receiver = receiver;
	}

	/** @return null. */
	@Column(name = "DUE_DATE", length = 50)
	public String getDueDate() {
		return this.dueDate;
	}

	/**
	 * @param dueDate
	 *            null.
	 */
	public void setDueDate(String dueDate) {
		this.dueDate = dueDate;
	}

	@Transient
	public User getReceiverUser() {
		return receiverUser;
	}

	public void setReceiverUser(User receiverUser) {
		this.receiverUser = receiverUser;
	}

}
